home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / utmisc2 / datebkiv.lha / DateBookIV / Rexx / TestDBCommands.rexx < prev    next >
OS/2 REXX Batch file  |  1996-03-31  |  7KB  |  442 lines

  1. /* File : dbrx.rexx
  2.  *
  3.  * $Project:         DateBook
  4.  *
  5.  * $Description:  Test all the rexx features in DateBook.       
  6.  *
  7.  * $Module Id:         
  8.  * $Original Author:   Robert Hardy
  9.  * $Date Started:      Sun Feb 26 1995
  10.  *
  11.  * $Revision: 1.4 $
  12.  *
  13.  * $State: Exp $
  14.  *
  15.  * $Locker:  $
  16.  *
  17.  * $Log: dbrx.rexx-v $
  18. # Revision 1.4  1996/02/06  07:46:46  Bob
  19. # Cleaned up report tests.
  20. #
  21. # Revision 1.3  1995/12/17  08:55:39  Bob
  22. # fixed typo.
  23. #
  24. # Revision 1.2  1995/11/20  00:49:54  Bob
  25. # Added support for new Notes and Priority fields.
  26. # fixed setting time field test.
  27. #
  28. # Revision 1.1  1995/03/22  20:30:21  Bob
  29. # Initial revision
  30.  *
  31.  *
  32.  */
  33.  
  34. options results
  35.  
  36. TICK = '27'X
  37.  
  38.  
  39. port_name = 'datebook_rx'
  40. port_off = 0
  41.  
  42. if ~show('p', port_name) then do        /* Find Out if DynaEngine is running */
  43.  
  44.     port_off = 1                    /* Set the flag so we can clean up on exit */
  45.  
  46.         /* Run Datebook */
  47.     address command 'run DateBook mode=SERVER RXPORT='port_name' FILE=dates.dat'
  48.     address command 'waitforport 'port_name        /* Wait till it's loaded */
  49. end
  50.  
  51. address VALUE port_name
  52.  
  53.  
  54. say ''
  55. say '** getting first **'
  56. 'GOTORECORD FIRST'
  57. if (rc = 0) then 
  58.     say 'result = "'result'"'
  59. else 
  60.     say 'rc = 'rc
  61.  
  62. say ''
  63. say '** Getting first record **'
  64. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  65. if (rc = 0) then
  66.     say 'result = "'result'"'
  67. else 
  68.     say 'rc = 'rc
  69.  
  70. say ''
  71. say '** Getting next record **'
  72. 'NEXTRECORD'
  73. if (rc = 0) then 
  74.     say 'result = "'result'"'
  75. else 
  76.     say 'rc = 'rc
  77.  
  78. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  79. if (rc = 0) then 
  80.     say 'result = "'result'"'
  81. else 
  82.     say 'rc = 'rc
  83.  
  84. say ''
  85. say '** Getting previous record **'
  86. 'PREVRECORD'
  87. if (rc = 0) then 
  88.     say 'result = "'result'"'
  89. else 
  90.     say 'rc = 'rc
  91.  
  92. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  93. if (rc = 0) then 
  94.     say 'result = "'result'"'
  95. else 
  96.     say 'rc = 'rc
  97.  
  98. say ''
  99. say '** Getting last record **'
  100. 'GOTORECORD LAST'
  101. if (rc = 0) then 
  102.     say 'result = "'result'"'
  103. else 
  104.     say 'rc = 'rc
  105.  
  106. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  107. if (rc = 0) then 
  108.     say 'result = "'result'"'
  109. else 
  110.     say 'rc = 'rc
  111.  
  112. say ''
  113. say '** Getting record 3 **'
  114. 'GOTORECORD 3'
  115. if (rc = 0) then 
  116.     say 'result = "'result'"'
  117. else 
  118.     say 'rc = 'rc
  119.  
  120. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  121. if (rc = 0) then 
  122.     say 'result = "'result'"'
  123. else 
  124.     say 'rc = 'rc
  125.  
  126. say ''
  127. say '** Searching for "christ" **'
  128. 'FINDRECORD $E christ'
  129. if (rc = 0) then 
  130. do
  131.     say 'result = "'result'"'
  132.  
  133.     'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  134.     if (rc = 0) then 
  135.         say 'result = "'result'"'
  136.     else
  137.         say 'rc = 'rc
  138.  
  139.     say ''
  140.     say '** Looking for next match **'
  141.     'nextmatch'
  142.     if (rc = 0) then
  143.     do
  144.         say 'result = "'result'"'
  145.  
  146.         'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  147.         if (rc = 0) then 
  148.             say 'result = "'result'"'
  149.         else
  150.              say 'rc = 'rc
  151.  
  152.         nop
  153.     end
  154.     else
  155.         say 'rc = 'rc
  156.  
  157.     say ''
  158.     say '** moving to last record **'
  159.     'GOTORECORD LAST'
  160.     if (rc = 0) then 
  161.         say 'result = "'result'"'
  162.     else 
  163.         say 'rc = 'rc
  164.  
  165.     say ''
  166.     say '** Looking for previous match **'
  167.     'prevmatch'
  168.     if (rc = 0) then
  169.     do
  170.         say 'result = "'result'"'
  171.         'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  172.         if (rc = 0) then 
  173.             say 'result = "'result'"'
  174.         else 
  175.             say 'rc = 'rc
  176.     end
  177.     else
  178.         say 'rc = 'rc
  179.  
  180. end
  181. else 
  182.     say 'rc = 'rc
  183.  
  184. say ''
  185. say '** Printing month summary **'
  186. 'summary 11 1996'
  187. if (rc = 0) then 
  188.     say result
  189. else do
  190.     if rc = 5 then
  191.         say 'Nothing to Report'
  192.     else
  193.         say 'rc = 'rc
  194. end
  195.  
  196. say ''
  197. say '** Printing todays events **'
  198. 'today'
  199. if (rc = 0) then 
  200.     say 'result = "'result'"'
  201. else do
  202.     if rc = 5 then
  203.         say 'Nothing to Report'
  204.     else
  205.         say 'rc = 'rc
  206. end
  207.  
  208. say ''
  209. say '** getting events for a date **'
  210. 'EVENTS 19960228'
  211. if (rc = 0) then 
  212.     say 'result = "'result'"'
  213. else do
  214.     if rc = 5 then
  215.         say 'Nothing to Report'
  216.     else
  217.         say 'rc = 'rc
  218. end
  219.  
  220. say ''
  221. say '** Getting upcoming events **'
  222. 'UPCOMMING'
  223. if (rc = 0) then 
  224.     say 'result = "'result'"'
  225. else do
  226.     if rc = 5 then
  227.         say 'Nothing to Report'
  228.     else
  229.         say 'rc = 'rc
  230. end
  231.  
  232.  
  233. say ''
  234. say '** Adding a record **'
  235. 'ADDRECORD'
  236. if (rc = 0) then 
  237.     say 'result = "'result'"'
  238. else 
  239.     say 'rc = 'rc
  240.  
  241. say ''
  242. say '** Setting record contents **'
  243. 'SETFIELD $d 19960102 $t 0100 $e Test Event xxx $y k $w 5 $f 2 $x 'TICK'say 'TICK'hello'TICK
  244. if (rc = 0) then 
  245.     say 'result = "'result'"'
  246. else 
  247.     say 'rc = 'rc
  248.  
  249. 'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  250. if (rc = 0) then 
  251.     say 'result = "'result'"'
  252. else 
  253.     say 'rc = 'rc
  254.  
  255. say ''
  256. say '** Sorting Database **'
  257. 'sortdb'
  258. if (rc = 0) then 
  259.     say 'result = "'result'"'
  260. else 
  261.     say 'rc = 'rc
  262.  
  263. say ''
  264. say '** Looking for record we added **'
  265. 'FINDRECORD $E xxx'
  266. if (rc = 0) then 
  267. do
  268.     recnum = result
  269.     say 'recnum = 'recnum
  270.  
  271.     'GETFIELD $d $t $p $e $y $w $f $x $r $n'
  272.     if (rc = 0) then 
  273.         say 'result = "'result'"'
  274.     else
  275.         say 'rc = 'rc
  276.  
  277.     say ''
  278.     say '** deleting record **'
  279.     'DELETERECORD'
  280.     if (rc = 0) then 
  281.         say 'result = "'result'"'
  282.     else
  283.         say 'rc = 'rc
  284. end
  285. else 
  286.     say 'rc = 'rc
  287.  
  288. say ''
  289. say '** Saving Database **'
  290. 'savedb datestest.dat'
  291. if (rc = 0) then 
  292.     say 'result = "'result'"'
  293. else 
  294.     say 'rc = 'rc
  295.  
  296.  
  297. say ''
  298. say '** Test String2date tomorrow **'
  299. 'STRING2DATE tomorrow'
  300. if (rc = 0) then 
  301.     say 'result = "'result'"'
  302. else 
  303.     say 'rc = 'rc
  304.  
  305. say ''
  306. say '** Test String2date today **'
  307. 'STRING2DATE today'
  308. if (rc = 0) then 
  309.     say 'result = "'result'"'
  310. else 
  311.     say 'rc = 'rc
  312.  
  313. say ''
  314. say '** Test String2date saturday **'
  315. 'STRING2DATE saturday'
  316. if (rc = 0) then 
  317.     say 'result = "'result'"'
  318. else 
  319.     say 'rc = 'rc
  320.  
  321. say ''
  322. say '** Test GetMonthName 1 **'
  323. 'GETMONTHNAME 1'
  324. if (rc = 0) then 
  325.     say 'result = "'result'"'
  326. else 
  327.     say 'rc = 'rc
  328.  
  329. say ''
  330. say '** Test GetMonthName 11 **'
  331. 'GETMONTHNAME 11'
  332. if (rc = 0) then 
  333.     say 'result = "'result'"'
  334. else 
  335.     say 'rc = 'rc
  336.  
  337. say ''
  338. say '** Test DayName 19950322 **'
  339. 'DAYNAME 19950322'
  340. if (rc = 0) then 
  341.     say 'result = "'result'"'
  342. else 
  343.     say 'rc = 'rc
  344.  
  345. say ''
  346. say '** Test Expand_Date 19950309 **'
  347. 'EXPANDDATE 19950309'
  348. if (rc = 0) then 
  349.     say 'result = "'result'"'
  350. else 
  351.     say 'rc = 'rc
  352.  
  353. say ''
  354. say '** Test ISVALID 19951332 **'
  355. 'ISVALID 19951332'
  356. if (rc = 0) then 
  357.     say 'result = "'result'"'
  358. else 
  359.     say 'rc = 'rc
  360.  
  361. say ''
  362. say '** Test ISVALID 19950302 **'
  363. 'ISVALID 19950302'
  364. if (rc = 0) then 
  365.     say 'result = "'result'"'
  366. else 
  367.     say 'rc = 'rc
  368.  
  369. say ''
  370. say '** Changing to Iconified mode - AppIcon **'
  371.  
  372. SETICONIFY 'ICON'
  373. if (rc = 0) then 
  374.     say 'old iconify type = "'result'"'
  375. else 
  376.     say 'rc = 'rc
  377.  
  378. CHANGEMODE 'ICONIFY'
  379. if (rc = 0) then 
  380.     say 'old mode = "'result'"'
  381. else 
  382.     say 'rc = 'rc
  383. delay(50 * 5)
  384.  
  385. say ''
  386. say '** Changing to Editor mode **'
  387.  
  388. CHANGEMODE 'EDIT'
  389. if (rc = 0) then 
  390.     say 'old mode = "'result'"'
  391. else 
  392.     say 'rc = 'rc
  393. delay(50 * 5)
  394.  
  395. say ''
  396. say '** Changing to Iconified mode - Clock **'
  397.  
  398. SETICONIFY 'CLOCK'
  399. if (rc = 0) then 
  400.     say 'old iconify type = "'result'"'
  401. else 
  402.     say 'rc = 'rc
  403. CHANGEMODE 'ICONIFY'
  404. if (rc = 0) then 
  405.     say 'old mode = "'result'"'
  406. else 
  407.     say 'rc = 'rc
  408. delay(50 * 5)
  409.  
  410. say ''
  411. say '** Changing to  Memo mode **'
  412.  
  413. CHANGEMODE 'MEMO'
  414. if (rc = 0) then 
  415.     say 'old mode = "'result'"'
  416. else 
  417.     say 'rc = 'rc
  418. delay(50 * 5)
  419.  
  420. say ''
  421. say '** Changing to Iconified mode - Calendar **'
  422.  
  423. SETICONIFY 'CAL'
  424. if (rc = 0) then 
  425.     say 'old iconify type = "'result'"'
  426. else 
  427.     say 'rc = 'rc
  428.  
  429. CHANGEMODE 'ICONIFY'
  430. if (rc = 0) then 
  431.     say 'old mode = "'result'"'
  432. else 
  433.     say 'rc = 'rc
  434.  
  435. say ''
  436. say "All done!"
  437.  
  438. if port_off > 0 then 'SHUTDOWN'
  439.  
  440. exit 0
  441.